﻿using System;
using System.Globalization;
using Antlr3.ST;

namespace WebApplication1.Classes {
    internal class AdvancedDateTimeRenderer : IAttributeRenderer {
        public string ToString(object o) {
            return ToString(o, null);
        }

        public string ToString(object o, string formatName) {
            if (o == null)
                return null;

            if (string.IsNullOrEmpty(formatName))
                return o.ToString();


            var dt = Convert.ToDateTime(o);
            //return string.Format(new CultureInfo("es-CL"), formatName, dt);
            formatName = "{0:" + formatName + "}";
            //var foo = new System.Globalization.CultureInfo("en-US");            
            return String.Format(new CultureInfo("EN-US"),formatName, dt);

        }
    }
}

